package spring.cloud.tasks.api.utils;

public class Response {
    //
    public static final String success_code = "200";
    public static final String fail_code = "500";
    private String code;
    private String message;
    private Object body;

    public static Response success() {
        Response response = new Response();
        response.setCode(success_code);
        return response;
    }

    public static Response success(Object body) {
        Response response = new Response();
        response.setCode(success_code);
        response.setBody(body);
        return response;
    }

    public static Response success(String message, Object body) {
        Response response = new Response();
        response.setCode(success_code);
        response.setMessage(message);
        response.setBody(body);
        return response;
    }

    public static Response fail(String message) {
        Response response = new Response();
        response.setCode(fail_code);
        response.setMessage(message);
        return response;
    }

    public static Response fail(String message, Object body) {
        Response response = new Response();
        response.setCode(fail_code);
        response.setMessage(message);
        response.setBody(body);
        return response;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getBody() {
        return body;
    }

    public void setBody(Object body) {
        this.body = body;
    }
}
